package com.feibi.firstplugin;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.Nullable;
import t.R.J;

import javax.swing.*;
import java.awt.*;

public class NotifyDialog extends DialogWrapper {
    String msg;

    public NotifyDialog(@Nullable Project project, String msg) {
        super(project);
        this.msg = msg;
        init();
    }

    @Override
    protected @Nullable
    JComponent createCenterPanel() {
        JPanel jPanel = new JPanel();
        jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
        JLabel label = new JLabel(msg);
        jPanel.add(label);
        return jPanel;
    }

    @Override
    protected @Nullable
    JComponent createSouthPanel() {
        JPanel jPanel = new JPanel();
        JButton button = new JButton("确认");
        button.addActionListener(e -> {
            dispose();
        });
        jPanel.add(button);
        return jPanel;
    }

}
